/*
package com.good.child.http;

import android.app.Activity;
import android.content.Context;
import android.util.Log;

import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
import com.alibaba.sdk.android.oss.callback.OSSProgressCallback;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSStsTokenCredentialProvider;
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
import com.alibaba.sdk.android.oss.model.PutObjectResult;
import com.good.child.config.Constants;

*/
/**
 * Create by xiaojie on 2024/8/7
 *//*

public class Imgupload {
    private static Imgupload instance;

    public static Imgupload getInstance() {
        if (instance == null) {
            synchronized (Imgupload.class) {
                if (instance == null) {
                    instance = new Imgupload();
                }
            }
        }
        return instance;
    }

    public void uploadImage(Context context, String images) {
        String endpoint = Constants.OSSBEAN.ENDPOINT;
        // 从STS服务获取的临时访问密钥（AccessKey ID和AccessKey Secret）。
        String accessKeyId = Constants.OSSBEAN.ACCESSKEYID;
        String accessKeySecret = Constants.OSSBEAN.ACCESSKEYSECRET;
        // 从STS服务获取的安全令牌（SecurityToken）。
        String securityToken = "";
       // String securityToken = Constants.OSSBEAN.BUCKETNAME;

        endpoint="oss-cn-hangzhou.aliyuncs.com";

        securityToken="CAISoAJ1q6Ft5B2yfSjIr5DbP/7Wvrpzg/aYZlDIi1UmS+RvtqvnuDz2IH1KenVoCO8esvo0mmpZ7/Yelq5RUJZJQE3CNTOSKy6tqFHPWZHInuDox61m4cTXBQr+Ihr/29CoLIedZdjBe/CrRknZnytou9XTfimjWFrXVv/sjoV8POwKQi6ybzdNGK18RG1YpdQdKGHaONu0LxfumRCwNkdzvRdmgm4Np8bzy8aHuB3Flw+4mK1HpZ+0Pp2/KMNtOJM4CY/vh6kuKe+ZjmkSyWATqP4n0/EfpGie5o/CWAEP2XjcbbqIqO8IBRRie603F5RDqPXBjvBisoTR7d+qlUgRZbAKC3iBH976kZKURPnKKtMiMLHgIDHE2duf9DoLQcmkyxgagAGOUYaEQ7ns2r2dGLsx3bCoAJpjLiakYYSKytrasr3Yjwlk3MbMf4IgsavwGza71AYBL1x5JTMXmBAIZcrDx2Fn8BiWq/ulso2lb4yiyhbyKlbd9W5PKQNML++hn2SAzZhnfGI8Myhs04zcDIXhoHU5F32E4xPRncHibnanHoXcTA==";

        accessKeyId="STS.NSntDbSeR44sdvyoUsGkCYnLZ";

        accessKeySecret="CgN62aS3dJqfhV7xqqGmE5vMUwiWYhQJ3FCd7ELH6fWQ";

        OSSCredentialProvider credentialProvider = new OSSStsTokenCredentialProvider(accessKeyId, accessKeySecret, securityToken);
        // 创建OSSClient实例。
        OSSClient oss = new OSSClient(context, endpoint, credentialProvider);
        String prefix = images.substring(images.lastIndexOf(".") + 1);


        String imageName = images.split("/")[images.split("/").length - 1];
        String objectKey = "bill/2023-07-06/" + imageName;
        // 构造上传请求。
       // PutObjectRequest put = new PutObjectRequest(Constants.OSSBEAN.BUCKETNAME, objectKey, images);
        PutObjectRequest put = new PutObjectRequest("js-tms", objectKey, images);

        // 异步上传时可以设置进度回调。
        put.setProgressCallback(new OSSProgressCallback<PutObjectRequest>() {
            @Override
            public void onProgress(PutObjectRequest request, long currentSize, long totalSize) {
                Log.d("PutObject", "currentSize: " + currentSize + " totalSize: " + totalSize);
            }
        });

        OSSAsyncTask task = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
            @Override
            public void onSuccess(PutObjectRequest request, PutObjectResult result) {
                Log.d("PutObject", "UploadSuccess");
                Log.d("ETag", result.getETag());
                Log.d("RequestId", result.getRequestId());
                ((Activity)context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                       // mCallimguploadImpl.imgUploadResult(stsResponseBean.getExportEndpoint() +"/"+ objectKey);
                    }
                });
            }

            @Override
            public void onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException) {
                // 请求异常。
                if (clientExcepion != null) {
                    // 本地异常，如网络异常等。
                    clientExcepion.printStackTrace();
                }
                if (serviceException != null) {
                    // 服务异常。
                    Log.e("ErrorCode", serviceException.getErrorCode());
                    Log.e("RequestId", serviceException.getRequestId());
                    Log.e("HostId", serviceException.getHostId());
                    Log.e("RawMessage", serviceException.getRawMessage());
                }
            }
        });
// task.cancel(); // 可以取消任务。
// task.waitUntilFinished(); // 等待上传完成。
    }
}
*/
